import menu from './modules/menu'
import largeDose from './modules/large-dose'
import ReactWare from './modules/react-ware'
import FastRate from './modules/base-rate'
import ChargetExhuast from './modules/ChargeExhuast'
import MachineSetting from './modules/MachineSetting'
import AdvanceSetting from './modules/AdvanceSetting'

import layout from '@/layout/'

/**
 * 在主框架内显示
 */
const frameIn = [
  {
    path: '/',
    redirect: { name: 'index' },
    component: layout,
    children: [
      // 首页 必须 name:index
      {
        path: 'index',
        name: 'index',
        meta: {
          auth: false // 如果是需要登录则改为true
        },
        component: () => import('@/pages/home/')
      },
      // 统计页面
      {
        path: '/home/statistics',
        name: 'statistics',
        meta: {
          auth: false // 如果是需要登录则改为true
        },
        component: () => import('@/pages/home/statistics')
      },
      // 迈世通logo页面
      {
        path: '/home/mst',
        name: 'mst',
        meta: {
          auth: false // 如果是需要登录则改为true
        },
        component: () => import('@/pages/home/mst')
      },
      // 刷新页面 必须保留
      {
        path: 'refresh',
        name: 'refresh',
        hidden: true,
        component: {
          beforeRouteEnter(to, from, next) {
            next(vm => vm.$router.replace(from.fullPath))
          },
          render: h => h()
        }
      },
      // 页面重定向 必须保留
      {
        path: 'redirect/:route*',
        name: 'redirect',
        hidden: true,
        component: {
          beforeRouteEnter(to, from, next) {
            next(vm => vm.$router.replace(JSON.parse(from.params.route)))
          },
          render: h => h()
        }
      }
    ]
  },
  menu,
  largeDose,
  ReactWare,
  FastRate,
  ChargetExhuast,
  MachineSetting,
  AdvanceSetting
]

// 导出需要显示菜单的
export const frameInRoutes = frameIn

// 重新组织后导出
export default [
  ...frameIn,
]
